<?php
$v_record_id = 0;
if(isset($_REQUEST['hdn_record_id'])){
//	$v_record_id = intval($_REQUEST['hdn_record_id']);
	$v_record_id = ($_REQUEST['hdn_record_id']);
}
$v_record_id_list = 0;
if(isset($_REQUEST['hdn_record_id_list'])){
//	$v_record_id = intval($_REQUEST['hdn_record_id']);
	$v_record_id_list = ($_REQUEST['hdn_record_id_list']);
}
$v_record_id_list = $v_record_id;
//Luu trang ngay tiep nhan hien thoi
if(isset($_REQUEST['hdn_received_date_filter'])){
	$v_receive_date_filter = $_REQUEST['hdn_received_date_filter'];
}
//DatCQ bo sung de in bien nhan nhieu ho so
if(isset($_REQUEST['name_staff_receipt'])){
	$name_staff_receipt = $_REQUEST['name_staff_receipt'];
}
if(isset($_REQUEST['address_staff_receipt'])){
	$address_staff_receipt = $_REQUEST['address_staff_receipt'];
}
if(isset($_REQUEST['date_receipt'])){
	$date_receipt = $_REQUEST['date_receipt'];
}
//Bo sung in bien nhan dat dai
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
}
//End

#DINHNQ REMMED - DATE: 24/05/07
# Content: In noi dung phieu trinh ky
/*
if(isset($_REQUEST['hdn_record_id_list'])){
	$v_record_id = intval($_REQUEST['hdn_record_id_list']);
}
//Luu trang ngay tiep nhan hien thoi
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
}
*/
//echo $v_record_id ;
/*ngay mai lam tiep*/
if(_is_sqlserver()){//CSDL MSSQL 
	// Lay noi dung cua mot ho so
	if($fuseaction=='DISPLAY_SINGLE_RECORD_WORK_KIEN'){
	$fuseaction='DISPLAY_SINGLE_RECORD_WORK_KIEN';
	$arr_record_ids = explode(',', $v_record_id_list);
	$v_record_id = intval($arr_record_ids[0]);
	$v_list_c_code = '';
	$n = sizeof($arr_record_ids) - 1;
	for($i=0;$i<sizeof($arr_record_ids);$i++){
			$v_record_id_i=$arr_record_ids[$i];
			$sql = "Exec Onegate_RecordGetSingle " . $v_record_id_i ;				
			$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
			$arr_single_record = $ado_conn->GetRow($sql); 
			//echo $sql;
			if($i == $n)
			{
				$v_list_c_code=$v_list_c_code.$arr_single_record['C_CODE'];
			}
			else
				$v_list_c_code=$v_list_c_code.$arr_single_record['C_CODE'].',';	
		}
	/* the end ngay mai lam tiep*/
		
		//echo 'Test asdkfsdaj '.sizeof($arr_single_record);	
		$arr_single_record[C_RECEIVED_RECORD_XML_DATA] = stripslashes($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);
		$arr_single_record[C_LICENSE_XML_DATA] = stripslashes($arr_single_record[C_LICENSE_XML_DATA]);
		//$v_recordtype_name2 = $arr_single_record['C_RECORDTYPE_NAME'];
	
		//var_dump($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);

		//Bo sung ngay dang ky DatCQ
//		$v_record_relate = _XML_get_xml_tag_value($arr_single_record[C_RECEIVED_RECORD_XML_DATA],'relate_record');
//		echo $v_record_relate;
/*		if($v_record_relate!= ''){
			$sql = "select  dbo.f_GetValueOfXMLtag(c_license_xml_data, 'record_date') as NgayDangKy
					from T_ONEGATE_RECORD 
					where C_CODE like '".$v_record_relate."'";
			$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
			$arr_single_record_date = $ado_conn->GetRow($sql); 
		}*/
		
		//Bo sung in bien nhan dat dai
		$sql = "Exec Onegate_RecordProgressLandSelect '".$v_record_id."','".$v_recordtype_filter."'";
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_single_record_progress_land = $ado_conn->GetRow($sql); 
	
		// Lay thong tin file anh
		session_start();
		$_SESSION['v_record_id_session'] = $v_record_id;
		if($v_record_id > 0){
			$sql = "Exec Onegate_RecordAttachFileGetAll " . $v_record_id ;
			$arr_all_attach_file = _adodb_query_data_in_name_mode($sql);
			$_SESSION['arr_attach'] = $arr_all_attach_file;
			//$_SESSION['v_record_id_session'] = $v_record_id;
		}
	}else{
	$v_record_id_list = explode(',',$_REQUEST['hdn_record_id']);
	if(sizeof($v_record_id_list) <=1){
		$v_record_id = intval($v_record_id);
		$sql = "Exec Onegate_RecordGetSingle " . $v_record_id ;				
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_single_record = $ado_conn->GetRow($sql); 	
		
		//echo 'Test asdkfsdaj '.sizeof($arr_single_record);	
		$arr_single_record[C_RECEIVED_RECORD_XML_DATA] = stripslashes($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);
		$arr_single_record[C_LICENSE_XML_DATA] = stripslashes($arr_single_record[C_LICENSE_XML_DATA]);
		//$v_recordtype_name2 = $arr_single_record['C_RECORDTYPE_NAME'];
	
		//var_dump($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);

		//Bo sung ngay dang ky DatCQ
//		$v_record_relate = _XML_get_xml_tag_value($arr_single_record[C_RECEIVED_RECORD_XML_DATA],'relate_record');
//		echo $v_record_relate;
/*		if($v_record_relate!= ''){
			$sql = "select  dbo.f_GetValueOfXMLtag(c_license_xml_data, 'record_date') as NgayDangKy
					from T_ONEGATE_RECORD 
					where C_CODE like '".$v_record_relate."'";
			$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
			$arr_single_record_date = $ado_conn->GetRow($sql); 
		}*/
		
		//Bo sung in bien nhan dat dai
		$sql = "Exec Onegate_RecordProgressLandSelect '".$v_record_id."','".$v_recordtype_filter."'";
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_single_record_progress_land = $ado_conn->GetRow($sql); 
	
		// Lay thong tin file anh
		session_start();
		$_SESSION['v_record_id_session'] = $v_record_id;
		if($v_record_id > 0){
			$sql = "Exec Onegate_RecordAttachFileGetAll " . $v_record_id ;
			$arr_all_attach_file = _adodb_query_data_in_name_mode($sql);
			$_SESSION['arr_attach'] = $arr_all_attach_file;
			//$_SESSION['v_record_id_session'] = $v_record_id;
		}
	}
	}
}
?>